package tea.servlet;

import java.io.IOException;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.stuCourse;
import entity.teaCourse;
import stu.dao.StudentDaoImpl;
import tea.dao.teaDaoImpl;


/**
 * Servlet implementation class SaveStuServlet
 */
@WebServlet("/SaveteaCourse")
public class SaveteaCourse extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
    public SaveteaCourse() {
        super();
       
    }
    

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html);charset=utf-8");
		String classroom = request.getParameter("classroom");
		String cname = request.getParameter("cname");
		String cno = request.getParameter("cno");				
		String date = request.getParameter("date");	
		teaCourse stu= new teaCourse();
		stu.setClassroom(classroom);
		stu.setCname(cname);
		stu.setCno(cno);
		stu.setDate(date);
	    
		teaDaoImpl info = new teaDaoImpl();
		boolean result=info.save(stu);
		if(result){
			request.getRequestDispatcher("FindteaCourse").forward(request, response);
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

